<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #cv {
        border: 3px solid #999;
      }
    </style>
  </head>
  <body>
    <canvas id="cv" width="200px" height="150px">您的浏览器不支持canvas</canvas>
  </body>
  <script>
    var cv = document.getElementById("cv");
    if (cv.getContext("2d")) {
      var ctx = cv.getContext("2d");
      // 开始一个路径的绘制
      ctx.beginPath();
      ctx.moveTo(75, 25);
      ctx.quadraticCurveTo(25, 25, 25, 65);
      ctx.quadraticCurveTo(25, 100, 50, 100);
      ctx.quadraticCurveTo(50, 120, 30, 125);
      ctx.quadraticCurveTo(60, 120, 65, 100);
      ctx.quadraticCurveTo(125, 100, 125, 60);
      ctx.quadraticCurveTo(125, 25, 75, 25);
      ctx.lineWidth = 5;//设置线宽
      ctx.strokeStyle = "pink";//设置描边颜色
      ctx.stroke();
    } else {
      console.log("您的浏览器不支持canvas");
    }
  </script>
</html>
